package com.lucker.ds.model;

import java.util.Date;

/**
 * page_ad
 * @author 
 */
public class PageAd extends BaseValueObject {
    private Long id;

    /**
     * 所属页面
     */
    private String viewPage;

    /**
     * 页面锚点 按页面上的块枚举字符串作为锚点值
     */
    private String pageTarget;

    /**
     * 资源类型
     */
    private String sourceType;

    /**
     * 显示图片
     */
    private String viewPic;

    /**
     * 资源标题
     */
    private String sourceTitle;

    /**
     * 资源标题描述
     */
    private String sourceDesc;

    /**
     * 资源ID
     */
    private Long sourceId;

    /**
     * 是否跳转 1 跳转 0 不跳转
     */
    private Integer isSkip;

    /**
     * 跳转类型 1 原生内跳转 2跳转网页
     */
    private String skipType;

    /**
     * 跳转URL
     */
    private String skipUrl;

    private Integer orderIndex;

    private String isDelete;

    private Date createTime;

    private Date updateTime;

    private String updateUser;

    private String customQuerySqlText = null;

    private String orderStr = null;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getViewPage() {
        return viewPage;
    }

    public void setViewPage(String viewPage) {
        this.viewPage = viewPage;
    }

    public String getPageTarget() {
        return pageTarget;
    }

    public void setPageTarget(String pageTarget) {
        this.pageTarget = pageTarget;
    }

    public String getSourceType() {
        return sourceType;
    }

    public void setSourceType(String sourceType) {
        this.sourceType = sourceType;
    }

    public String getViewPic() {
        return viewPic;
    }

    public void setViewPic(String viewPic) {
        this.viewPic = viewPic;
    }

    public String getSourceTitle() {
        return sourceTitle;
    }

    public void setSourceTitle(String sourceTitle) {
        this.sourceTitle = sourceTitle;
    }

    public String getSourceDesc() {
        return sourceDesc;
    }

    public void setSourceDesc(String sourceDesc) {
        this.sourceDesc = sourceDesc;
    }

    public Long getSourceId() {
        return sourceId;
    }

    public void setSourceId(Long sourceId) {
        this.sourceId = sourceId;
    }

    public Integer getIsSkip() {
        return isSkip;
    }

    public void setIsSkip(Integer isSkip) {
        this.isSkip = isSkip;
    }

    public String getSkipType() {
        return skipType;
    }

    public void setSkipType(String skipType) {
        this.skipType = skipType;
    }

    public String getSkipUrl() {
        return skipUrl;
    }

    public void setSkipUrl(String skipUrl) {
        this.skipUrl = skipUrl;
    }

    public Integer getOrderIndex() {
        return orderIndex;
    }

    public void setOrderIndex(Integer orderIndex) {
        this.orderIndex = orderIndex;
    }

    public String getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(String isDelete) {
        this.isDelete = isDelete;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getUpdateUser() {
        return updateUser;
    }

    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }

    public void setCustomQuerySqlText(String customQuerySqlText) {
        this.customQuerySqlText = customQuerySqlText;
    }

    public String getCustomQuerySqlText() {
        return customQuerySqlText;
    }

    public void orderById(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by id asc";
            }else{
                this.orderStr = this.orderStr + ",id asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by id desc";
            }else{
                this.orderStr = this.orderStr + ",id desc";
            }
        }
    }

    public void orderByViewPage(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by view_page asc";
            }else{
                this.orderStr = this.orderStr + ",view_page asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by view_page desc";
            }else{
                this.orderStr = this.orderStr + ",view_page desc";
            }
        }
    }

    public void orderByPageTarget(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by page_target asc";
            }else{
                this.orderStr = this.orderStr + ",page_target asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by page_target desc";
            }else{
                this.orderStr = this.orderStr + ",page_target desc";
            }
        }
    }

    public void orderBySourceType(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by source_type asc";
            }else{
                this.orderStr = this.orderStr + ",source_type asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by source_type desc";
            }else{
                this.orderStr = this.orderStr + ",source_type desc";
            }
        }
    }

    public void orderByViewPic(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by view_pic asc";
            }else{
                this.orderStr = this.orderStr + ",view_pic asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by view_pic desc";
            }else{
                this.orderStr = this.orderStr + ",view_pic desc";
            }
        }
    }

    public void orderBySourceTitle(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by source_title asc";
            }else{
                this.orderStr = this.orderStr + ",source_title asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by source_title desc";
            }else{
                this.orderStr = this.orderStr + ",source_title desc";
            }
        }
    }

    public void orderBySourceDesc(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by source_desc asc";
            }else{
                this.orderStr = this.orderStr + ",source_desc asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by source_desc desc";
            }else{
                this.orderStr = this.orderStr + ",source_desc desc";
            }
        }
    }

    public void orderBySourceId(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by source_id asc";
            }else{
                this.orderStr = this.orderStr + ",source_id asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by source_id desc";
            }else{
                this.orderStr = this.orderStr + ",source_id desc";
            }
        }
    }

    public void orderByIsSkip(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by is_skip asc";
            }else{
                this.orderStr = this.orderStr + ",is_skip asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by is_skip desc";
            }else{
                this.orderStr = this.orderStr + ",is_skip desc";
            }
        }
    }

    public void orderBySkipType(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by skip_type asc";
            }else{
                this.orderStr = this.orderStr + ",skip_type asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by skip_type desc";
            }else{
                this.orderStr = this.orderStr + ",skip_type desc";
            }
        }
    }

    public void orderBySkipUrl(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by skip_url asc";
            }else{
                this.orderStr = this.orderStr + ",skip_url asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by skip_url desc";
            }else{
                this.orderStr = this.orderStr + ",skip_url desc";
            }
        }
    }

    public void orderByOrderIndex(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by order_index asc";
            }else{
                this.orderStr = this.orderStr + ",order_index asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by order_index desc";
            }else{
                this.orderStr = this.orderStr + ",order_index desc";
            }
        }
    }

    public void orderByIsDelete(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by is_delete asc";
            }else{
                this.orderStr = this.orderStr + ",is_delete asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by is_delete desc";
            }else{
                this.orderStr = this.orderStr + ",is_delete desc";
            }
        }
    }

    public void orderByCreateTime(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by create_time asc";
            }else{
                this.orderStr = this.orderStr + ",create_time asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by create_time desc";
            }else{
                this.orderStr = this.orderStr + ",create_time desc";
            }
        }
    }

    public void orderByUpdateTime(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by update_time asc";
            }else{
                this.orderStr = this.orderStr + ",update_time asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by update_time desc";
            }else{
                this.orderStr = this.orderStr + ",update_time desc";
            }
        }
    }

    public void orderByUpdateUser(boolean isAsc) {
        if(isAsc){
            if(this.orderStr == null){
                this.orderStr = "order by update_user asc";
            }else{
                this.orderStr = this.orderStr + ",update_user asc";
            }
        }else{
            if(this.orderStr == null){
                this.orderStr = "order by update_user desc";
            }else{
                this.orderStr = this.orderStr + ",update_user desc";
            }
        }
    }
}